package WaiBao;

import java.util.Arrays;

public class FanBoHuan {
    public static void main(String[] args) {
        String[] name = {"薛宝钗(班长)", "李道和(副班长)", "小李(学习委员)", "李二牛(团支书)", "王铁柱", "张二狗", "李勋", "郭晨", "李杨凯", "帐篷法", "李德宝", "谢光琼",
                "李晓", "李晨", "王一博", "赵四", "户户", "李霞", "王卓艺", "吕是杰", "吕昆阳", "王一顿", "张晓红", "邓伦", "张涵予", "周润发", "周星驰", "吴孟达",
                "郭黄圣依", "范博欢(宣传委员)"};//考生本人:李范博欢(宣传委员)
        int[] age = {19,20,21, 21, 22,21, 19, 18, 18, 19, 21, 19, 18, 20, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 20, 19, 18, 21};//考生年龄：21

        double[] liluo1 = {69, 78, 59, 85, 74, 68, 78, 80, 60, 80, 90, 77, 85, 79, 64, 68, 69, 99, 96, 88, 92, 91, 95, 85, 75, 74, 74, 84, 89, 96};
        double[] liluo2 = {64, 84, 80, 84, 71, 86, 74, 83, 69, 70, 95, 67, 84, 75, 95, 65, 86, 79, 66, 78, 82, 71, 85, 85, 75, 89, 74, 79, 84, 95};
        double[] liluo3 = {80, 83, 99, 74, 85, 75, 63, 69, 80, 69, 73, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 88, 73, 78, 78, 95};



        double shouhuan1;//代表每个学生的总分
        double shouhuan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shouhuan1 =  liluo1[i] +  liluo2[i] + liluo3[i];
//            shouhuan2 = (shouhuan1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +shouhuan1);
//            System.out.println(name[i] + "的平均分为:" +  shouhuan2);
//        }


        double gulu1 = 0, gulu2 = 0;
        double[] luntia = new double[30];
//        for (int i = 0; i < 30; i++) {
//            gulu1 = liluo1[i] +  liluo2[i] + liluo3[i];
//            gulu2 = (gulu1 * 1.0) / 3;
//            luntia[i] = gulu2;
//        }
//
//        for (int i = 0; i <luntia.length - 1; i++) {
//            for (int j = 0; j < luntia.length - i - 1; j++) {
//                if (luntia[j] < luntia[j + 1]) {
//                    double tep = luntia[j];
//                    luntia[j] = luntia[j + 1];
//                    luntia[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(luntia[i]);
//        }




        double shuye1 = 0,shuye2 = 0, shuye3 = 0;//计算每门课的平均分
        double shuzi1 = 0,shuzi2 = 0,shuzi3 = 0;//计算每门课标准差
        double ring1 = 0,  ring2 = 0, ring3 = 0;//计算每门课中位数
        double sap = 0;
        for (int i = 0; i < liluo1.length; i++) {
            sap+=liluo1[i];
        }
        shuye1 = (sap*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ shuye1);
        double Sum = 0;
        for (int i = 0; i < liluo2.length; i++) {
            Sum+=liluo2[i];
        }
        shuye2 = (Sum*1.0)/30;
        System.out.println("物理化学的班级平均分为:"+shuye2);
        double sum = 0;
        for (int i = 0; i <liluo3.length; i++) {
            sum+=liluo3[i];
        }
        shuye3 = (sum*1.0)/30;
        System.out.println("电子与电工技术的班级平均分为:"+shuye3);




        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <liluo1.length; i++) {
            c1+= (liluo1[i] - shuye1)*(liluo1[i] - shuye1);
        }
        shuzi1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ shuzi1);

        for (int i = 0; i <liluo2.length; i++) {
            c2+= (liluo2[i] - shuye2)*(liluo2[i] -shuye2);
        }
        shuzi2 = Math.sqrt(c2*1.0/30);
        System.out.println("物理化学的班级标准差为:"+ shuzi2);

        for (int i = 0; i <liluo3.length; i++) {
            c3+= (liluo3[i] - shuye3)*(liluo3[i] - shuye3);
        }
        shuzi3 = Math.sqrt(c3*1.0/30);
        System.out.println("电子与电工技术的班级标准差为:"+shuzi3);
//////
//////
//////
//        Arrays.sort(liluo1);
//        Arrays.sort(liluo2);
//        Arrays.sort(liluo3);
//        ring1 =( liluo1[14]+liluo1[15])*1.0/2;
//        ring2 =( liluo2[14]+liluo2[15])*1.0/2;
//        ring3 =( liluo3[14]+liluo3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+  ring1);
//        System.out.println("物理化学的中位数为:"+  ring2);
//        System.out.println("电子与电工技术的中位数为:"+  ring3);





    }
}
